﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucBulletin.ascx.cs"
    Inherits="LongSpeed.WebSite.UserControl.ucBulletin" %>
<%@ OutputCache Duration="300" VaryByParam="none" Shared="true" %>
<div class="sblock1">
    <div class="sblock1-top">
        久速公告</div>
    <div class="sblock1-bottom">
        <%         
            string title;

            LongSpeed.WebSite.Behaviors.Article notice = new LongSpeed.WebSite.Behaviors.Article();
            var notices = notice.GetAllArticleByPart((int)LongSpeed.WebSite.Behaviors.ArticlePart.站内公告).OrderByDescending(o => o.ReleaseDate).Take(10);
        %>
        <ul class="gonggao">
            <%            
                foreach (var item in notices)
                {
                    title = item.Title.Length > 11 ? item.Title.Substring(0, 11) + "…" : item.Title;
                    string url;
                    if (string.IsNullOrEmpty(item.FromUrl) || string.IsNullOrWhiteSpace(item.FromUrl))
                    {
                        url = string.Format("new-{0}-{1}.html", item.ID, item.Part);
                    }
                    else
                    {
                        url = string.Format("../{0}", item.FromUrl);
                    }                   
            %>
            <li><a href="<%=(url) %>" target="_parent" title="<%=(item.Title) %>">
                <%=(title) %>
            </a></li>
            <%
                }            
            %>
        </ul>
    </div>
</div>
